cmake_minimum_required(VERSION 2.8)
project(pf-astar)

# find JNI
find_package(Java REQUIRED)
find_package(JNI REQUIRED)

# path finding root.
set(pf_root "${CMAKE_CURRENT_SOURCE_DIR}")
set(pf_build_dir "${CMAKE_BINARY_DIR}")

add_definitions(
  -std=c++11
)

set(PathFinding_Library_SRCS
  ${pf_root}/src/utils.h
  ${pf_root}/src/point.cpp
  ${pf_root}/src/point.h
  ${pf_root}/src/hash_point.h
  ${pf_root}/src/graph.cpp
  ${pf_root}/src/graph.h
  ${pf_root}/src/astar.cpp
  ${pf_root}/src/astar.h
)

set(PathFinding_Test_SRCS
  ${pf_root}/test/main.cpp
)

IF(MSC_VER)
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:CONSOLE")
ENDIF(MSC_VER)

include_directories("${pf_root}")

include_directories("${CMAKE_CURRENT_BINARY_DIR}")
add_library(libastar STATIC ${PathFinding_Library_SRCS})

add_executable(astar-test ${PathFinding_Test_SRCS})
target_link_libraries(astar-test libastar)

